<script setup lang="ts">
import { RouterView } from "vue-router";
import { usePrinterStore } from '@/stores/printer'
import { onMounted, onUnmounted } from "vue";
import { ConfigProvider } from "ant-design-vue";
import zhCN from 'ant-design-vue/es/locale/zh_CN';
import UserHook from '@/components/user-hook.vue'

const { start, stop } = usePrinterStore()

onMounted(() => {
  if (import.meta.env.VITE_PRINT === 'ON') {
    start(true)
  }
})
onUnmounted(() => {
  if (import.meta.env.VITE_PRINT === 'ON') {
    stop()
  }
})
</script>

<template>
  <ConfigProvider :locale="zhCN">
    <UserHook></UserHook>
    <div class="w-screen h-screen">
      <RouterView v-slot="{ Component }">
        <component :is="Component"></component>
      </RouterView>
    </div>
  </ConfigProvider>
</template>
